package com.spring_mysql_redis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spring_mysql_redis.entity.Message;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Repository;

@Repository
public interface MessageMapper extends BaseMapper<Message> {

    //异步删除7天前消息
    @Async
    @Delete("delete from sp_message where DATE(send_time) <= DATE(DATE_SUB(NOW(),INTERVAL 7 DAY));")
    public void deleteDate();
}
